Technote 1185New ColorSync 3.0 APIsBy Steve Evangelou, Eric Broadbent and Scott KuechleApple Worldwide Developer Technical Support |
CONTENTS
System Requirements |
This Technote describes the APIs your application can use to take advantage of new features available in ColorSync 3.0. |
Boolean CheckIfColorSyncAvailableOnPPC (void) { Boolean ColorSyncAvailable = false; long gestaltResponse; if (Gestalt(gestaltColorMatchingAttr, &gestaltResponse) == noErr) { ColorSyncAvailable = gestaltResponse & (1 << gestaltColorMatchingLibLoaded); } return ColorSyncAvailable; } |
Alternately, you can use the ColorSync function
The |
#define kColorSync3 0x00000300 CMError err; UInt32 version; err = CMGetColorSyncVersion(&version); if (err == noErr) { if (version >= kColorSync3) { /* ColorSync 3 is installed */ } } else { /* ColorSync not present */ } |
Getting ColorSync 3.0 Version Information
As described in the section above, use the ColorSync
Alternately, you can use the
You can modify and use the following sample code to test for version 3.0 of the ColorSync Manager. This function initializes the |
#define kColorSync3 0x00000300 Boolean CheckForColorSyncVersion3(void) { Boolean ColorSyncAvailable = false; long version; if (Gestalt(gestaltColorMatchingVersion, &version) == noErr) { if (version >= kColorSync3) { ColorSyncAvailable = true; } } return ColorSyncAvailable; } |
enum { cmInputUse = 'inpt', cmOutputUse = 'outp', cmDisplayUse = 'dply', cmProofUse = 'pruf' }; |
cmInputUse | Specifies the preferred input device profile. |
cmOutputUse | Specifies the preferred output device profile. |
cmDisplayUse | Specifies the preferred display device profile. |
cmProofUse | Specifies the preferred proofing device profile. |
The |
pascal CMError CMGetDefaultProfileByUse ( OSType use, CMProfileRef * prof); |
The |
pascal CMError CMSetDefaultProfileByUse ( OSType use, CMProfileRef prof); |
enum { cmXYZData = 'XYZ ', cmLabData = 'Lab ', cmRGBData = 'RGB ', cmGrayData = 'GRAY', cmCMYKData = 'CMYK' }; |
cmXYZData | Specifies XYZ space. |
cmLabData | Specifies LAB space. |
cmRGBData | Specifies RGB space. |
cmGrayData | Specifies Gray space. |
cmCMYKData | Specifies CMYK space. |
The CMGetDefaultProfileBySpace
function is defined as follows:
pascal CMError CMGetDefaultProfileBySpace ( OSType dataColorSpace, CMProfileRef * prof); |
The |
pascal CMError CMSetDefaultProfileBySpace ( OSType dataColorSpace, CMProfileRef prof); |
pascal CMError CMGetPreferredCMM ( OSType * cmmType, Boolean * preferredCMMnotfound); |
Note: |
With ColorSync 3.0, your application can launch the ColorSync control panel to solicit color choices, including default profiles for devices and documents, as well as preferred CMM. Users can also switch between named collections of color settings called workflows (described in detail in “About ColorSync 3.0”). Many applications have made the decision to take responsibility for color management preferences as part of their user interface (UI). Now, with the ability to launch the ColorSync control panel from within an application, perhaps some or all of that extra UI and code can be eliminated, and users can be exposed to a standard color management UI, provided by ColorSync. To launch the ColorSync control panel from your application, you call the following function: |
pascal CMError CMLaunchControlPanel (UInt32 flags); |
When your application calls the |
DownloadablesAcknowledgmentsThanks to David Hayward. To contact us, please use the Contact Us page.
|